home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / UNIX / C / C-STYLE / STYLE_CO.SED < prev    next >
Text File  |  1992-11-23  |  458b  |  35 lines

  1.     s/ Decomment a C program    /&/
  2.  
  3. :start
  4.  
  5.     s/ Strip trailing spaces    /&/
  6.  
  7. /[ ]*$/        s/[ ]*$//
  8.  
  9.     s/ Lose comment-only lines    /&/
  10.  
  11. /^[ ]*@.*`$/    d
  12.  
  13.     s/ Strip short comments        /&/
  14.  
  15. /@.*`/        s/@[^@]*`//g
  16.  
  17.     s/ Strip multiple comments    /&/
  18.  
  19. /^[ ]*@.*$/    b loop
  20. /@.*$/        {    s/[ ]*@.*$//p
  21.             :loop
  22.             n
  23.                 s/ Ensure flag is reset        /&/
  24.             t dummy
  25.             :dummy
  26.                 s/ Go on until delimiter    /&/
  27.             s/^[^@]*`//
  28. /^[ ]*$/ d
  29.             t start
  30.             b loop
  31.         }
  32.                 s/ Print whatever's left    /&/
  33.         p
  34.  
  35.